<template>
  <div class="btn" :class="{ primary: type === 'primary' }" @click="btnFn">
    <slot>按钮</slot>
  </div>
</template>

<script>
export default {
  props: {
    type: String,
  },
  methods: {
    btnFn(e) {
      this.$emit("click", e);
    },
  },
};
</script>

<style lang="less" scoped>
.btn {
  display: flex;
  width: 318px;
  height: 45px;
  margin: 20px auto;
  font-size: 20px;
  justify-content: center;
  align-items: center;
  background-color: grey;
  border-radius: 24px;
}
.primary {
  background-color: red;
  color: white;
}
</style>
